#define  _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include<assert.h>
#include<vector>
#include<algorithm>
using namespace std;
//成最多水的容器
class Solution {
public:
    int maxArea(vector<int>& height)
    {
        int left = 0;
        int right = height.size() - 1;
        int count = 0;
        while (left < right)
        {
            int area = (right - left) * min(height[left], height[right]);
            count = max(count, area);
            if (height[right] < height[left])
            {
                right--;
            }
            else {
                left++;
            }
        }
        return count;
    }
};

//有效三角形的个数
class Solution {
public:
    int triangleNumber(vector<int>& nums) {
        sort(nums.begin(), nums.end());
        int  n = nums.size() - 1;
        int ret = 0;
        for (int i = n; i > 1; i--)
        {
            int left = 0, right = i - 1;
            while (left < right)
            {
                if (nums[left] + nums[right] > nums[i])
                {
                    ret += (right - left);
                    right--;
                }
                else {
                    left++;
                }
            }
        }
        return ret;

    }
};




int main()
{


    return 0;
}